package com.bookmall.common.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import java.util.HashMap;

/**
 * @Description:
 * @Author 胡菜鸡
 * @Create 2022-04-08-17:57
 */
public class OpenFeignDataUtils extends HashMap<String, Object> {

    public <T> T getData(String key, TypeReference<T> typeReference){
        Object data = get(key);
        String dataString = JSON.toJSONString(data);	//对象转成String
        T t = JSON.parseObject(dataString, typeReference);	//String在转成对应类型
        return t;
    }
}
